import random


def cq():
    while True:
        people = input('输入[0:剪刀][1:布][石头:2][退出:9]')
        computer = str(random.randint(0, 2))
        print('你出了:',change(people))
        print('电脑出了:', change(computer))
        if '9' == people:
            break
        if people == '0' and computer == '1':
            print(change(people), '赢了', change(computer))
        elif people == '1' and computer == '2':
            print(change(people), '赢了', change(computer))
        elif people == '2' and computer == '0':
            print(change(people), '赢了', change(computer))
        elif people == computer:
            print('平局')
        elif change(people) == '4':
            print('输入错误')
        else:
            print(change(computer), '赢了', change(people))


def change(a):
    if a == '0':
        a = "剪刀"
    elif a == '1':
        a = '布'
    elif a == '2':
        a = '石头'
    else:
        a = '4'
    return a


if __name__ == '__main__':
    cq()
